package com.trkj.controller.lzs;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.trkj.pojo.Salary;
import com.trkj.pojo.SalaryProject;
import com.trkj.pojo.SocialLeixing;
import com.trkj.pojo.SocialSecurity;
import com.trkj.service.lzs.SalaryProjectService;
import com.trkj.vo.Result2;
@Controller
public class SalaryProjectConeroller {
//常用薪资表项目
	@Autowired
	private   SalaryProjectService salaryProjectService;
	//查询
	@RequestMapping("lzs_SalaryProjectfindAll")
		@ResponseBody
		public List<SalaryProject> getJSON2(){
			List<SalaryProject> list = salaryProjectService.SalaryProjectfindAll();
	/*		list.forEach(e->{
				System.err.println("aaaaa"+e);
			});*/
			return list;
		}

	  //添加
	@RequestMapping("lzs_SalaryProjecianjia")
	@ResponseBody
	public void SalarySabletianjia(String projectName ,String projectSource,BigDecimal projectMoney, String projectFormula,Timestamp projectCreatordate,Timestamp projectUpdatedate){
		salaryProjectService.SocialSecuritytj(projectName, projectSource, projectMoney, projectFormula, projectCreatordate, projectUpdatedate);
	}
	/*修改
	*/
	@RequestMapping("lzs_SalaryProjexiugai")
	@ResponseBody  
	public  Result2 SalaryProjectxiugai( Long projectId, String projectName ,String projectSource,BigDecimal projectMoney, String projectFormula,Timestamp projectCreatordate,Timestamp projectUpdatedate) {
		try {
			salaryProjectService.lzs_Edit_a(projectId, projectName, projectSource, projectMoney, projectFormula, projectCreatordate, projectUpdatedate);
			return Result2.SUCCESS;
		} catch (Exception e) {
				e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
		
	}
	@RequestMapping("lzs_SalaryProjebj")
	@ResponseBody  
	 public SalaryProject chunq(Long projectId) {
    	 return salaryProjectService.chun_a(projectId);
     }
	
	
	//模糊查询shuoy
			@RequestMapping("lzs_SalaryProjchaxun")
			@ResponseBody
			public  List<SalaryProject> Query(String text){
			
				return (List<SalaryProject>) salaryProjectService.queryByName(text);
			}
			//删除；通过id查出相应的一条数据
			@RequestMapping("hr_ra_form_SalaryProj")
			@ResponseBody
			public boolean hr_ra_form_SalaryProj(Long projectId){
				 return salaryProjectService.dltRaw(projectId);
			}
			
}